package com.koushikdutta.ion;

import com.koushikdutta.async.ByteBufferList;
import com.koushikdutta.async.future.FutureCallback;

class LoadBitmap extends LoadBitmapEmitter implements FutureCallback<ByteBufferList> {
    int resizeHeight;
    int resizeWidth;

    public LoadBitmap(Ion ion, String urlKey, boolean put, int resizeWidth, int resizeHeight, boolean animateGif, EmitterTransform<ByteBufferList> emitterTransform) {
        super(ion, urlKey, put, animateGif, emitterTransform);
        this.resizeWidth = resizeWidth;
        this.resizeHeight = resizeHeight;
        this.animateGif = animateGif;
        this.emitterTransform = emitterTransform;
    }

    public void onCompleted(Exception e, final ByteBufferList result) {
        if (e != null) {
            report(e, null);
        } else if (this.ion.bitmapsPending.tag(this.key) != this) {
            result.recycle();
        } else {
            Ion.getBitmapLoadExecutorService().execute(new Runnable() {
                public void run() {
                    /* JADX: method processing error */
/*
Error: java.util.NoSuchElementException
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:925)
	at java.util.HashMap$KeyIterator.next(HashMap.java:956)
	at jadx.core.dex.visitors.blocksmaker.BlockFinallyExtract.applyRemove(BlockFinallyExtract.java:535)
	at jadx.core.dex.visitors.blocksmaker.BlockFinallyExtract.extractFinally(BlockFinallyExtract.java:175)
	at jadx.core.dex.visitors.blocksmaker.BlockFinallyExtract.processExceptionHandler(BlockFinallyExtract.java:79)
	at jadx.core.dex.visitors.blocksmaker.BlockFinallyExtract.visit(BlockFinallyExtract.java:51)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:14)
	at jadx.core.ProcessClass.process(ProcessClass.java:37)
	at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:280)
	at jadx.api.JavaClass.decompile(JavaClass.java:62)
*/
                    /*
                    r17 = this;
                    r0 = r17;
                    r1 = com.koushikdutta.ion.LoadBitmap.this;
                    r1 = r1.ion;
                    r1 = r1.bitmapsPending;
                    r0 = r17;
                    r2 = com.koushikdutta.ion.LoadBitmap.this;
                    r2 = r2.key;
                    r1 = r1.tag(r2);
                    r0 = r17;
                    r2 = com.koushikdutta.ion.LoadBitmap.this;
                    if (r1 == r2) goto L_0x0020;
                L_0x0018:
                    r0 = r17;
                    r1 = r4;
                    r1.recycle();
                L_0x001f:
                    return;
                L_0x0020:
                    r7 = 0;
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r4;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r7 = r1.getAll();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r1.ion;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r1.bitmapCache;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r7.array();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r3 = r7.arrayOffset();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r4 = r7.position();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r3 = r3 + r4;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r4 = r7.remaining();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r5 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r5 = r5.resizeWidth;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r6 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r6 = r6.resizeHeight;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r15 = r1.prepareBitmapOptions(r2, r3, r4, r5, r6);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r16 = new android.graphics.Point;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r15.outWidth;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r15.outHeight;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r16;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0.<init>(r1, r2);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r1.animateGif;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r1 == 0) goto L_0x00e6;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x0065:
                    r1 = "image/gif";	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r15.outMimeType;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = android.text.TextUtils.equals(r1, r2);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r1 == 0) goto L_0x00e6;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x006f:
                    r10 = new com.koushikdutta.ion.gif.GifDecoder;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r7.array();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r7.arrayOffset();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r3 = r7.position();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r2 + r3;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r3 = r7.remaining();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r4 = new com.koushikdutta.ion.LoadBitmap$1$1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r4.<init>();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r10.<init>(r1, r2, r3, r4);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r10.run();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r10.getFrameCount();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r1 != 0) goto L_0x00b2;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x0095:
                    r1 = new java.lang.Exception;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = "failed to load gif";	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1.<init>(r2);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    throw r1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x009d:
                    r12 = move-exception;
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = new java.lang.Exception;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2.<init>(r12);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r3 = 0;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1.report(r2, r3);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r7 == 0) goto L_0x001f;
                L_0x00ad:
                    com.koushikdutta.async.ByteBufferList.reclaim(r7);
                    goto L_0x001f;
                L_0x00b2:
                    r1 = r10.getFrameCount();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r9 = new android.graphics.Bitmap[r1];	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r11 = r10.getDelays();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r13 = 0;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x00bd:
                    r1 = r10.getFrameCount();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r13 >= r1) goto L_0x0113;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x00c3:
                    r8 = r10.getFrameImage(r13);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r8 != 0) goto L_0x00e1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x00c9:
                    r1 = new java.lang.Exception;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = "failed to load gif frame";	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1.<init>(r2);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    throw r1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x00d1:
                    r12 = move-exception;
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = 0;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1.report(r12, r2);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r7 == 0) goto L_0x001f;
                L_0x00dc:
                    com.koushikdutta.async.ByteBufferList.reclaim(r7);
                    goto L_0x001f;
                L_0x00e1:
                    r9[r13] = r8;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r13 = r13 + 1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    goto L_0x00bd;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x00e6:
                    r1 = r7.array();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r7.arrayOffset();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r3 = r7.position();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r2 + r3;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r3 = r7.remaining();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r8 = com.koushikdutta.ion.bitmap.IonBitmapCache.loadBitmap(r1, r2, r3, r15);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r8 != 0) goto L_0x010c;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x00fd:
                    r1 = new java.lang.Exception;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = "failed to load bitmap";	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1.<init>(r2);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    throw r1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x0105:
                    r1 = move-exception;
                    if (r7 == 0) goto L_0x010b;
                L_0x0108:
                    com.koushikdutta.async.ByteBufferList.reclaim(r7);
                L_0x010b:
                    throw r1;
                L_0x010c:
                    r1 = 1;
                    r9 = new android.graphics.Bitmap[r1];	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = 0;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r9[r1] = r8;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r11 = 0;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x0113:
                    r14 = new com.koushikdutta.ion.bitmap.BitmapInfo;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r1.key;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = r15.outMimeType;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r16;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r14.<init>(r1, r2, r9, r0);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r14.delays = r11;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r1.emitterTransform;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r1 == 0) goto L_0x0147;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x012c:
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r1.emitterTransform;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = r1.loadedFrom();	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r14.loadedFrom = r1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                L_0x0138:
                    r0 = r17;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1 = com.koushikdutta.ion.LoadBitmap.this;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r2 = 0;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    r1.report(r2, r14);	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    if (r7 == 0) goto L_0x001f;
                L_0x0142:
                    com.koushikdutta.async.ByteBufferList.reclaim(r7);
                    goto L_0x001f;
                L_0x0147:
                    r1 = 1;
                    r14.loadedFrom = r1;	 Catch:{ OutOfMemoryError -> 0x009d, Exception -> 0x00d1, all -> 0x0105 }
                    goto L_0x0138;
                    */
                    throw new UnsupportedOperationException("Method not decompiled: com.koushikdutta.ion.LoadBitmap.1.run():void");
                }
            });
        }
    }
}
